#ifndef SRC_MESSAGE_H
#define SRC_MESSAGE_H

#include <string>
#include <stdint.h>

namespace sobriety
{
	enum { kOpen = 1, kUpdate = 2, kNotification = 3, kKeepalive = 4};
	enum {HEADER_SIZE = 19};

	struct bgp_settings
	{
		uint8_t version;
		uint16_t as;
		uint16_t hold;
		uint32_t id;
		
	};
	

	class Message
	{
		private:
			int type;
			int length;
			char *header;
			char *data;
			int bgp_ver;
			int my_as;
			int bgp_hold;
			uint32_t bgp_id;
			struct bgp_settings *settings;

		public:
			Message(int typeIn, struct bgp_settings *bgp_in);

			void makeHeader(int length);
			int makeOpen(struct opt_param *param_list);
			int makeNotification(int error_code, int error_subcode, std::string description);

			void packData(void **ptr_in, void *data_in, size_t data_size);

			void *getData();
			int getLength();
	};

}
#endif //SRC_MESSAGE_H
